{* new orders list *}
<table border="0" cellpadding="0" cellspacing="0">
<tr>
    <td valign="top"><h1>{'ordr_order_list'|transcape}</h1></td>
    <td valign="top" style="padding-left: 25px;"><form><button type="button" onClick="window.location='{$ocrt_url}';">{"pgn_order_creater"|translate}</button></form></td>
</tr>
</table>
{$MessageBlock}
{if $page_enabled}
	
		<form method="get" action="" name="MainForm">
			<input type="hidden" name="did" value="{$CurrentDivision.id}" />
			<table>
				<tr>
					<td valign="top">
						{if $order_statuses}
							<input class="inlradio" type="radio" name="order_search_type" value="SearchByStatusID" {if $order_search_type == 'SearchByStatusID'}checked="checked"{/if} onclick="order_search_typeClickHandler()" id="id_order_search_type2" /><label for="id_order_search_type2"> {"ordr_filter_by_status"|translate}</label>:
							{foreach from=$order_statuses item=_status}
							<div style="margin-left:20px;margin-top:3px;margin-bottom:3px;">
								<input class="checknomarging" type="checkbox" name="checkbox_order_status_{$_status.statusID}" id="id_checkbox_order_status_{$_status.statusID}"{if $_status.selected == 1} checked="checked"{/if} value="1" /><label for="id_checkbox_order_status_{$_status.statusID}" style="{$_status._style}"> {$_status.status_name}</label>
        						<span style="color: #AAAAAA;">({$_status.orders_count})</span>
							</div>
							{/foreach}
						{/if}
					</td>
					<td valign="top">
						<input class="inlradio" type="radio" name="order_search_type" value="SearchByOrderID" {if $order_search_type == 'SearchByOrderID' || $order_search_type == null} checked="checked" {/if}	onclick="order_search_typeClickHandler()" id="id_order_search_type1" /><label for="id_order_search_type1"> {"ordr_search_by_id"|translate}</label>:
						<div style="margin-left:20px;margin-top:3px;margin-bottom:3px;">
							<input type="text" name="orderID_textbox" value="{$orderID|escape:'html'}" />
						</div>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2">
						<input type="submit" value="{"btn_show"|translate}" name="search" />
					</td>
				</tr>
			</table>

			<script language="JavaScript" type="text/javascript">
				function order_search_typeClickHandler()
				{literal}{{/literal}
			
					if ( document.MainForm.order_search_type[1].checked )
					{literal}{{/literal}
						{foreach from=$order_statuses item=_status}
							document.MainForm.checkbox_order_status_{$_status.statusID}.disabled = true;
						{/foreach}
						document.MainForm.orderID_textbox.disabled = false;
					{literal}}{/literal}
					else if ( document.MainForm.order_search_type[0].checked )
					{literal}{{/literal}
						{foreach from=$order_statuses item=_status}
							document.MainForm.checkbox_order_status_{$_status.statusID}.disabled = false;
						{/foreach}
						document.MainForm.orderID_textbox.disabled = true;
					{literal}}{/literal}
				{literal}}{/literal}
			
				order_search_typeClickHandler();
			</script>

	<p>
	{if $orders}
		<div>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" class="grid">
			<tr class="gridsheader">{include file="backend/gridheader.tpl.html"}</tr>
			{section name=i loop=$orders}
				{assign var=order_url value="ukey=admin_order_detailed&orderID=`$orders[i].orderID`&rdid=`$CurrentDivision.id`"|set_query_html}
				{assign var=order_statusID value=$orders[i].statusID}

				<tr class="{cycle values="gridline1,gridline"}">
					<td><a href='{$order_url}' style="{$order_statuses[$order_statusID]._style}">{$orders[i].orderID_view}</a></td>
					<td><a href='{$order_url}' style="{$order_statuses[$order_statusID]._style}">{$orders[i].order_time}</a></td>
					<td><a href='{$order_url}' style="{$order_statuses[$order_statusID]._style}">{$orders[i].customer_firstname} {$orders[i].customer_lastname}</a></td>
					<td><a href='{$order_url}' style="{$order_statuses[$order_statusID]._style}">{$orders[i].payment_type|default:'&nbsp;'}</a></td>
					<td><a href='{$order_url}' style="{$order_statuses[$order_statusID]._style}">{$orders[i].shipping_type|default:'&nbsp;'}{if $orders[i].shippingServiceInfo} ({$orders[i].shippingServiceInfo}){/if}</a></td>
					<td><a href='{$order_url}' style="{$order_statuses[$order_statusID]._style}">{$orders[i].order_amount}</a></td>
					<td class="endgrid"><a href='{$order_url}' style="{$order_statuses[$order_statusID]._style}">{$orders[i].OrderStatus|default:'&nbsp;'}</a></td>
				</tr>
			{/section}
			<tr class="gridsfooter">
				<td colspan="7">{include file="backend/lister.tpl.html"}</td>
			</tr>
			<tr class="gridsfooter">
				<td colspan="5">
				{$TotalFound}<br>
				{if $order_statuses}
					{foreach from=$order_statuses item=_status}
					{if $_status.selected == 1} 
						<span style="{$_status._style}"> {$_status.status_name}:{$_status.orders_count} ({$_status.orders_amount_display})</span>
						<br/>
					{/if}
					{/foreach}
				{/if}
					<span style="font-weight: bold;">{lbl_str_total}: {$TotalCount} ({$total_statuses_amount})</span>
				</td>
				<td colspan="2">&nbsp;</td>
			</tr>
		</table>
		<p>* <small>{"ordr_msg_about_prices"|translate}</small></p>			
		{if $orders_has_been_exported_succefully != 1}
		<br>
		<p>{"export_orderlist_to_csv"|translate}</p>
		<p>{lbl_prdimport_file_charset}
			<select name="charset">
				{foreach from=$charsets item=_charset}
					<option value="{$_charset|escape:'html'}" {if $default_charset eq $_charset}selected="selected"{/if}>{$_charset|escape:'html'}</option>
				{/foreach}
			</select>
			<input type=submit name='export_to_excel' value='{"btn_export"|translate}'>
			</p>			
		{/if}
		</div>
	{else}
		<div><p>{"srch_no_matches_found"|translate}</p></div>
	{/if}
	
</form>


{/if}